﻿/*
版权所有：版权所有(C) 2010，刘建新
文件编号：M01_News.cs
文件名称：Market.cs
系统编号：Z0003007
系统名称：通用办公系统
模块编号：M01
模块名称：信息发布
设计文档：IOA_M01信息发布XDE建模.mdx
完成日期：2010/12/17
作　　者：
内容摘要：表[Market]对应的实体类
*/

using System;
using System.Collections;
using System.Data;


namespace Eis51.CampanyCMS.Model.NewsManager
{
    /// <summary>
    /// 类 编 号：
    /// 类 名 称：Market
    /// 内容摘要：
    /// </summary>

    [Serializable]
    public class Market : BaseModel
    {
        #region 自动生成代码

        #region 重载Equals/GetHashCode
        /// <summary>
        /// 重载Equals			
        /// </summary>
        public override bool Equals(Object obj)
        {
            if (obj != null && obj is Market)
            {
                if (obj == this)
                    return true;
                Market castObj = (Market)obj;

                if (!this.m_Seqno.Equals(castObj.Seqno))
                    return false;

                if (!this.m_Title.Equals(castObj.Title))
                    return false;

                if (!this.m_Type.Equals(castObj.Type))
                    return false;

                if (!this.m_Code.Equals(castObj.Code))
                    return false;

                if (!this.m_Content.Equals(castObj.Content))
                    return false;

                if (!this.m_Showdescr.Equals(castObj.Showdescr))
                    return false;

                if (!this.m_ValidData.Equals(castObj.ValidData))
                    return false;

                if (!this.m_Createby.Equals(castObj.Createby))
                    return false;

                if (!this.m_Createdate.Equals(castObj.Createdate))
                    return false;

                if (!this.m_Lasteupdateby.Equals(castObj.Lasteupdateby))
                    return false;

                if (!this.m_Lasteupdatedate.Equals(castObj.Lasteupdatedate))
                    return false;

                if (!this.m_ScanTimes.Equals(castObj.ScanTimes))
                    return false;

                if (!this.m_IsValid.Equals(castObj.IsValid))
                    return false;

                if (!this.m_Licd.Equals(castObj.Licd))
                    return false;

                if (!this.m_Filename.Equals(castObj.Filename))
                    return false;

                if (!this.m_Isfist.Equals(castObj.Isfist))
                    return false;

                if (!this.m_Ishot.Equals(castObj.Ishot))
                    return false;

                if (!this.m_ShowIdx.Equals(castObj.ShowIdx))
                    return false;

                return true;
            }
            return false;
        }

        /// <summary>
        /// 重载GetHashCode
        /// </summary>
        public override int GetHashCode()
        {
            int hash = 0;

            hash = hash << 8;
            if ((object)m_Seqno != null)
            {
                hash = hash ^ m_Seqno.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Title != null)
            {
                hash = hash ^ m_Title.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Type != null)
            {
                hash = hash ^ m_Type.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Code != null)
            {
                hash = hash ^ m_Code.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Content != null)
            {
                hash = hash ^ m_Content.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Showdescr != null)
            {
                hash = hash ^ m_Showdescr.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_ValidData != null)
            {
                hash = hash ^ m_ValidData.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Createby != null)
            {
                hash = hash ^ m_Createby.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Createdate != null)
            {
                hash = hash ^ m_Createdate.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Lasteupdateby != null)
            {
                hash = hash ^ m_Lasteupdateby.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Lasteupdatedate != null)
            {
                hash = hash ^ m_Lasteupdatedate.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_ScanTimes != null)
            {
                hash = hash ^ m_ScanTimes.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_IsValid != null)
            {
                hash = hash ^ m_IsValid.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Licd != null)
            {
                hash = hash ^ m_Licd.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Filename != null)
            {
                hash = hash ^ m_Filename.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Isfist != null)
            {
                hash = hash ^ m_Isfist.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_Ishot != null)
            {
                hash = hash ^ m_Ishot.GetHashCode();
            }

            hash = hash << 8;
            if ((object)m_ShowIdx != null)
            {
                hash = hash ^ m_ShowIdx.GetHashCode();
            }

            return hash;
        }
        #endregion

        public Market()
        {
            MarkNew();
        }

        public Market GetOldValue()
        {
            return OldValue as Market;
        }

        #region Seqno属性
        private int m_Seqno = 0;
        /// <summary>
        /// 属性名称： Seqno
        /// 内容摘要： DB列名：Seqno[]
        ///            DB类型：int
        /// </summary>
        public int Seqno
        {
            get
            {
                return m_Seqno;
            }
            set
            {
                if (m_Seqno as object == null || !m_Seqno.Equals(value))
                {
                    m_Seqno = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Title属性
        private string m_Title = String.Empty;
        /// <summary>
        /// 属性名称： Title
        /// 内容摘要： DB列名：Title[标题]
        ///            DB类型：string
        /// </summary>
        public string Title
        {
            get
            {
                return m_Title;
            }
            set
            {
                if (m_Title as object == null || !m_Title.Equals(value))
                {
                    m_Title = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Type属性
        private int m_Type = 0;
        /// <summary>
        /// 属性名称： Type
        /// 内容摘要： DB列名：Type[]
        ///            DB类型：int
        /// </summary>
        public int Type
        {
            get
            {
                return m_Type;
            }
            set
            {
                if (m_Type as object == null || !m_Type.Equals(value))
                {
                    m_Type = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Code属性
        private string m_Code = String.Empty;
        /// <summary>
        /// 属性名称： Code
        /// 内容摘要： DB列名：Code[]
        ///            DB类型：string
        /// </summary>
        public string Code
        {
            get
            {
                return m_Code;
            }
            set
            {
                if (m_Code as object == null || !m_Code.Equals(value))
                {
                    m_Code = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Content属性
        private string m_Content = String.Empty;
        /// <summary>
        /// 属性名称： Content
        /// 内容摘要： DB列名：Content[内容]
        ///            DB类型：string
        /// </summary>
        public string Content
        {
            get
            {
                return m_Content;
            }
            set
            {
                if (m_Content as object == null || !m_Content.Equals(value))
                {
                    m_Content = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Showdescr属性
        private string m_Showdescr = String.Empty;
        /// <summary>
        /// 属性名称： Showdescr
        /// 内容摘要： DB列名：ShowDescr[]
        ///            DB类型：string
        /// </summary>
        public string Showdescr
        {
            get
            {
                return m_Showdescr;
            }
            set
            {
                if (m_Showdescr as object == null || !m_Showdescr.Equals(value))
                {
                    m_Showdescr = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region ValidData属性
        private DateTime m_ValidData = new DateTime(1900, 1, 1);
        /// <summary>
        /// 属性名称： ValidData
        /// 内容摘要： DB列名：valid_Data[有效期]
        ///            DB类型：DateTime
        /// </summary>
        public DateTime ValidData
        {
            get
            {
                return DateTime.Parse(m_ValidData.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            set
            {
                if (m_ValidData as object == null || !m_ValidData.Equals(value))
                {
                    m_ValidData = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Createby属性
        private string m_Createby = String.Empty;
        /// <summary>
        /// 属性名称： Createby
        /// 内容摘要： DB列名：Createby[]
        ///            DB类型：string
        /// </summary>
        public string Createby
        {
            get
            {
                return m_Createby;
            }
            set
            {
                if (m_Createby as object == null || !m_Createby.Equals(value))
                {
                    m_Createby = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Createdate属性
        private DateTime m_Createdate = new DateTime(1900, 1, 1);
        /// <summary>
        /// 属性名称： Createdate
        /// 内容摘要： DB列名：CreateDate[]
        ///            DB类型：DateTime
        /// </summary>
        public DateTime Createdate
        {
            get
            {
                return DateTime.Parse(m_Createdate.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            set
            {
                if (m_Createdate as object == null || !m_Createdate.Equals(value))
                {
                    m_Createdate = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Lasteupdateby属性
        private string m_Lasteupdateby = String.Empty;
        /// <summary>
        /// 属性名称： Lasteupdateby
        /// 内容摘要： DB列名：LasteUpdateBy[]
        ///            DB类型：string
        /// </summary>
        public string Lasteupdateby
        {
            get
            {
                return m_Lasteupdateby;
            }
            set
            {
                if (m_Lasteupdateby as object == null || !m_Lasteupdateby.Equals(value))
                {
                    m_Lasteupdateby = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Lasteupdatedate属性
        private DateTime m_Lasteupdatedate = new DateTime(1900, 1, 1);
        /// <summary>
        /// 属性名称： Lasteupdatedate
        /// 内容摘要： DB列名：LasteUpdateDate[]
        ///            DB类型：DateTime
        /// </summary>
        public DateTime Lasteupdatedate
        {
            get
            {
                return DateTime.Parse(m_Lasteupdatedate.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            set
            {
                if (m_Lasteupdatedate as object == null || !m_Lasteupdatedate.Equals(value))
                {
                    m_Lasteupdatedate = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region ScanTimes属性
        private int m_ScanTimes = 0;
        /// <summary>
        /// 属性名称： ScanTimes
        /// 内容摘要： DB列名：scan_Times[浏览次数]
        ///            DB类型：int
        /// </summary>
        public int ScanTimes
        {
            get
            {
                return m_ScanTimes;
            }
            set
            {
                if (m_ScanTimes as object == null || !m_ScanTimes.Equals(value))
                {
                    m_ScanTimes = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region IsValid属性
        private int m_IsValid = 0;
        /// <summary>
        /// 属性名称： IsValid
        /// 内容摘要： DB列名：Is_Valid[是否有效]
        ///            DB类型：int
        /// </summary>
        public int IsValid
        {
            get
            {
                return m_IsValid;
            }
            set
            {
                if (m_IsValid as object == null || !m_IsValid.Equals(value))
                {
                    m_IsValid = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Licd属性
        private int m_Licd = 0;
        /// <summary>
        /// 属性名称： Licd
        /// 内容摘要： DB列名：Licd[中英文标志(1033/2052)]
        ///            DB类型：int
        /// </summary>
        public int Licd
        {
            get
            {
                return m_Licd;
            }
            set
            {
                if (m_Licd as object == null || !m_Licd.Equals(value))
                {
                    m_Licd = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Filename属性
        private string m_Filename = String.Empty;
        /// <summary>
        /// 属性名称： Filename
        /// 内容摘要： DB列名：FileName[]
        ///            DB类型：string
        /// </summary>
        public string Filename
        {
            get
            {
                return m_Filename;
            }
            set
            {
                if (m_Filename as object == null || !m_Filename.Equals(value))
                {
                    m_Filename = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Isfist属性
        private int m_Isfist = 0;
        /// <summary>
        /// 属性名称： Isfist
        /// 内容摘要： DB列名：IsFist[]
        ///            DB类型：int
        /// </summary>
        public int Isfist
        {
            get
            {
                return m_Isfist;
            }
            set
            {
                if (m_Isfist as object == null || !m_Isfist.Equals(value))
                {
                    m_Isfist = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region Ishot属性
        private int m_Ishot = 0;
        /// <summary>
        /// 属性名称： Ishot
        /// 内容摘要： DB列名：IsHot[]
        ///            DB类型：int
        /// </summary>
        public int Ishot
        {
            get
            {
                return m_Ishot;
            }
            set
            {
                if (m_Ishot as object == null || !m_Ishot.Equals(value))
                {
                    m_Ishot = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region ShowIdx属性
        private int m_ShowIdx = 0;
        /// <summary>
        /// 属性名称： ShowIdx
        /// 内容摘要： DB列名：show_idx[]
        ///            DB类型：int
        /// </summary>
        public int ShowIdx
        {
            get
            {
                return m_ShowIdx;
            }
            set
            {
                if (m_ShowIdx as object == null || !m_ShowIdx.Equals(value))
                {
                    m_ShowIdx = value;
                    MarkUpdated();
                }
            }
        }
        #endregion

        #region static CreateDataTable/FillDataRow/DataRow2Obj/Dt2Objs/FillDataTable
        /// <summary>
        /// 得到实体对应的DataTable
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="cne">列名映射选择:DB列名或属性名</param>
        /// <returns>生成的DataTable</returns>
        static public DataTable CreateDataTable(string tableName, ColumnNameEnum cne)
        {
            DataTable dtResult = new DataTable(tableName);

            if (cne == ColumnNameEnum.DBName)
            {
                dtResult.Columns.Add(new DataColumn("Seqno", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Title", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Type", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Code", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Content", typeof(string)));
                dtResult.Columns.Add(new DataColumn("ShowDescr", typeof(string)));
                dtResult.Columns.Add(new DataColumn("valid_Data", typeof(DateTime)));
                dtResult.Columns.Add(new DataColumn("Createby", typeof(string)));
                dtResult.Columns.Add(new DataColumn("CreateDate", typeof(DateTime)));
                dtResult.Columns.Add(new DataColumn("LasteUpdateBy", typeof(string)));
                dtResult.Columns.Add(new DataColumn("LasteUpdateDate", typeof(DateTime)));
                dtResult.Columns.Add(new DataColumn("scan_Times", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Is_Valid", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Licd", typeof(int)));
                dtResult.Columns.Add(new DataColumn("FileName", typeof(string)));
                dtResult.Columns.Add(new DataColumn("IsFist", typeof(int)));
                dtResult.Columns.Add(new DataColumn("IsHot", typeof(int)));
                dtResult.Columns.Add(new DataColumn("show_idx", typeof(int)));
            }
            else if (cne == ColumnNameEnum.PropertyName)
            {
                dtResult.Columns.Add(new DataColumn("Seqno", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Title", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Type", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Code", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Content", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Showdescr", typeof(string)));
                dtResult.Columns.Add(new DataColumn("ValidData", typeof(DateTime)));
                dtResult.Columns.Add(new DataColumn("Createby", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Createdate", typeof(DateTime)));
                dtResult.Columns.Add(new DataColumn("Lasteupdateby", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Lasteupdatedate", typeof(DateTime)));
                dtResult.Columns.Add(new DataColumn("ScanTimes", typeof(int)));
                dtResult.Columns.Add(new DataColumn("IsValid", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Licd", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Filename", typeof(string)));
                dtResult.Columns.Add(new DataColumn("Isfist", typeof(int)));
                dtResult.Columns.Add(new DataColumn("Ishot", typeof(int)));
                dtResult.Columns.Add(new DataColumn("ShowIdx", typeof(int)));
            }
            return dtResult;
        }

        /// <summary>
        /// 得到实体对应的DataTable
        /// </summary>
        /// <param name="cne">列名映射选择:DB列名或属性名</param>
        /// <returns>生成的DataTable</returns>
        static public DataTable CreateDataTable(ColumnNameEnum cne)
        {
            return CreateDataTable(null, cne);
        }

        /// <summary>
        /// 得到实体对应的DataTable(默认列名映射为属性名)
        /// </summary>
        /// <returns>生成的DataTable</returns>
        static public DataTable CreateDataTable()
        {
            return CreateDataTable(ColumnNameEnum.PropertyName);
        }

        /// <summary>
        /// 用当前对象值填充DaraRow
        /// </summary>
        /// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
        /// <param name="cne">dr的列名映射方式:DB列名或属性名</param>
        public void FillDataRow(DataRow dr, ColumnNameEnum cne)
        {
            if (dr == null)
            {
                throw new ArgumentNullException("dr");
            }
            if (ColumnNameEnum.DBName == cne)
            {
                dr["Seqno"] = this.Seqno;
                dr["Title"] = this.Title;
                dr["Type"] = this.Type;
                dr["Code"] = this.Code;
                dr["Content"] = this.Content;
                dr["ShowDescr"] = this.Showdescr;
                dr["valid_Data"] = this.ValidData;
                dr["Createby"] = this.Createby;
                dr["CreateDate"] = this.Createdate;
                dr["LasteUpdateBy"] = this.Lasteupdateby;
                dr["LasteUpdateDate"] = this.Lasteupdatedate;
                dr["scan_Times"] = this.ScanTimes;
                dr["Is_Valid"] = this.IsValid;
                dr["Licd"] = this.Licd;
                dr["FileName"] = this.Filename;
                dr["IsFist"] = this.Isfist;
                dr["IsHot"] = this.Ishot;
                dr["show_idx"] = this.ShowIdx;
            }
            else if (ColumnNameEnum.PropertyName == cne)
            {
                dr["Seqno"] = this.Seqno;
                dr["Title"] = this.Title;
                dr["Type"] = this.Type;
                dr["Code"] = this.Code;
                dr["Content"] = this.Content;
                dr["Showdescr"] = this.Showdescr;
                dr["ValidData"] = this.ValidData;
                dr["Createby"] = this.Createby;
                dr["Createdate"] = this.Createdate;
                dr["Lasteupdateby"] = this.Lasteupdateby;
                dr["Lasteupdatedate"] = this.Lasteupdatedate;
                dr["ScanTimes"] = this.ScanTimes;
                dr["IsValid"] = this.IsValid;
                dr["Licd"] = this.Licd;
                dr["Filename"] = this.Filename;
                dr["Isfist"] = this.Isfist;
                dr["Ishot"] = this.Ishot;
                dr["ShowIdx"] = this.ShowIdx;
            }
        }

        /// <summary>
        /// 用当前对象值填充DaraRow(默认列名映射为属性名)
        /// </summary>
        /// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
        public void FillDataRow(DataRow dr)
        {
            this.FillDataRow(dr, ColumnNameEnum.PropertyName);
        }

        /// <summary>
        /// 将DataRow转换成Market对象
        /// </summary>
        /// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
        /// <param name="cne">dr的列名映射方式:DB列名或属性名</param>
        /// <returns>Market对象</returns>
        public static Market Dr2Obj(DataRow dr, ColumnNameEnum cne)
        {
            if (dr == null)
            {
                throw new ArgumentNullException("dr");
            }
            Market obj = new Market();
            if (ColumnNameEnum.DBName == cne)
            {
                obj.Seqno = (dr["Seqno"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Seqno"], typeof(int));
                obj.Title = (dr["Title"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Title"], typeof(string));
                obj.Type = (dr["Type"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Type"], typeof(int));
                obj.Code = (dr["Code"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Code"], typeof(string));
                obj.Content = (dr["Content"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Content"], typeof(string));
                obj.Showdescr = (dr["ShowDescr"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["ShowDescr"], typeof(string));
                obj.ValidData = (dr["valid_Data"] == Convert.DBNull) ? new DateTime(1900, 1, 1) : (DateTime)Convert.ChangeType(dr["valid_Data"], typeof(DateTime));
                obj.Createby = (dr["Createby"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Createby"], typeof(string));
                obj.Createdate = (dr["CreateDate"] == Convert.DBNull) ? new DateTime(1900, 1, 1) : (DateTime)Convert.ChangeType(dr["CreateDate"], typeof(DateTime));
                obj.Lasteupdateby = (dr["LasteUpdateBy"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["LasteUpdateBy"], typeof(string));
                obj.Lasteupdatedate = (dr["LasteUpdateDate"] == Convert.DBNull) ? new DateTime(1900, 1, 1) : (DateTime)Convert.ChangeType(dr["LasteUpdateDate"], typeof(DateTime));
                obj.ScanTimes = (dr["scan_Times"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["scan_Times"], typeof(int));
                obj.IsValid = (dr["Is_Valid"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Is_Valid"], typeof(int));
                obj.Licd = (dr["Licd"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Licd"], typeof(int));
                obj.Filename = (dr["FileName"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["FileName"], typeof(string));
                obj.Isfist = (dr["IsFist"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["IsFist"], typeof(int));
                obj.Ishot = (dr["IsHot"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["IsHot"], typeof(int));
                obj.ShowIdx = (dr["show_idx"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["show_idx"], typeof(int));
            }
            else if (ColumnNameEnum.PropertyName == cne)
            {
                obj.Seqno = (dr["Seqno"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Seqno"], typeof(int));
                obj.Title = (dr["Title"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Title"], typeof(string));
                obj.Type = (dr["Type"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Type"], typeof(int));
                obj.Code = (dr["Code"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Code"], typeof(string));
                obj.Content = (dr["Content"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Content"], typeof(string));
                obj.Showdescr = (dr["Showdescr"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Showdescr"], typeof(string));
                obj.ValidData = (dr["ValidData"] == Convert.DBNull) ? new DateTime(1900, 1, 1) : (DateTime)Convert.ChangeType(dr["ValidData"], typeof(DateTime));
                obj.Createby = (dr["Createby"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Createby"], typeof(string));
                obj.Createdate = (dr["Createdate"] == Convert.DBNull) ? new DateTime(1900, 1, 1) : (DateTime)Convert.ChangeType(dr["Createdate"], typeof(DateTime));
                obj.Lasteupdateby = (dr["Lasteupdateby"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Lasteupdateby"], typeof(string));
                obj.Lasteupdatedate = (dr["Lasteupdatedate"] == Convert.DBNull) ? new DateTime(1900, 1, 1) : (DateTime)Convert.ChangeType(dr["Lasteupdatedate"], typeof(DateTime));
                obj.ScanTimes = (dr["ScanTimes"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["ScanTimes"], typeof(int));
                obj.IsValid = (dr["IsValid"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["IsValid"], typeof(int));
                obj.Licd = (dr["Licd"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Licd"], typeof(int));
                obj.Filename = (dr["Filename"] == Convert.DBNull) ? null : (string)Convert.ChangeType(dr["Filename"], typeof(string));
                obj.Isfist = (dr["Isfist"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Isfist"], typeof(int));
                obj.Ishot = (dr["Ishot"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["Ishot"], typeof(int));
                obj.ShowIdx = (dr["ShowIdx"] == Convert.DBNull) ? 0 : (int)Convert.ChangeType(dr["ShowIdx"], typeof(int));
            }

            return obj;
        }

        /// <summary>
        /// 将DataRow转换成Market对象(默认列名映射为属性名)
        /// </summary>
        /// <returns>Market对象</returns>
        public static Market Dr2Obj(DataRow dr)
        {
            return Dr2Obj(dr, ColumnNameEnum.DBName);
        }

        /// <summary>
        /// 将DataTabe转换成的Market对象集合
        /// </summary>
        /// <param name="dt">由CreateTable生成的DataTable</param>
        /// <param name="cne">dt的列名映射方式:DB列名或属性名</param>
        /// <returns>Market对象的集合</returns>
        public static IList Dt2Objs(DataTable dt, ColumnNameEnum cne)
        {
            if (dt == null)
            {
                throw new ArgumentNullException("dt");
            }

            ArrayList alResult = new ArrayList();

            foreach (DataRow dr in dt.Rows)
            {
                alResult.Add(Dr2Obj(dr, cne));
            }

            return alResult;
        }

        /// <summary>
        /// 将DataTabe转换成的Market对象集合(默认列名映射为属性名)
        /// </summary>
        /// <param name="dt">由CreateTable生成的DataTable</param>
        /// <returns>Market对象的集合</returns>
        public static IList Dt2Objs(DataTable dt)
        {
            return Dt2Objs(dt, ColumnNameEnum.PropertyName);
        }

        /// <summary>
        /// 用objs的Market对象集合填充DataTable
        /// </summary>
        /// <param name="dt">由CreateTable生成的DataTable</param>
        /// <param name="objs">Market对象集合</param>
        /// <param name="cne">dt的列名映射方式:DB列名或属性名</param>
        public static void FillDataTable(DataTable dt, IList objs, ColumnNameEnum cne)
        {
            if (dt == null)
            {
                throw new ArgumentNullException("dt");
            }
            if (objs == null)
            {
                throw new ArgumentNullException("objs");
            }

            foreach (Market obj in objs)
            {
                DataRow dr = dt.NewRow();
                obj.FillDataRow(dr, cne);
                dt.Rows.Add(dr);
            }
        }

        /// <summary>
        /// 用objs的Market对象集合填充DataTable(默认列名映射为属性名)
        /// </summary>
        /// <param name="dt">由CreateTable生成的DataTable</param>
        /// <param name="objs">Market对象集合</param>
        public static void FillDataTable(DataTable dt, IList objs)
        {
            FillDataTable(dt, objs, ColumnNameEnum.PropertyName);
        }
        #endregion

        /// <summary>
        /// 取消编辑,恢复到上次有效调用BeginEdit前的状态,并清空保留值
        /// </summary>
        public override void CancelEdit()
        {
            Market old = this.OldValue as Market;
            if (old != null)
            {
                this.Seqno = old.Seqno;
                this.Title = old.Title;
                this.Type = old.Type;
                this.Code = old.Code;
                this.Content = old.Content;
                this.Showdescr = old.Showdescr;
                this.ValidData = old.ValidData;
                this.Createby = old.Createby;
                this.Createdate = old.Createdate;
                this.Lasteupdateby = old.Lasteupdateby;
                this.Lasteupdatedate = old.Lasteupdatedate;
                this.ScanTimes = old.ScanTimes;
                this.IsValid = old.IsValid;
                this.Licd = old.Licd;
                this.Filename = old.Filename;
                this.Isfist = old.Isfist;
                this.Ishot = old.Ishot;
                this.ShowIdx = old.ShowIdx;
                this.OldValue = null;
            }
        }




        #region Market实体的内部Key类
        /// <summary>
        /// Market实体的Key类
        /// </summary>
        public sealed class Key
        {

            private int m_Seqno;
            public int Seqno
            {
                get
                {
                    return m_Seqno;
                }
                set
                {
                    m_Seqno = value;
                }
            }

            public Key(int pSeqno)
            {
                m_Seqno = pSeqno;

            }
        }
        #endregion
        /// <summary>
        /// 得到实体Market的PK
        /// </summary>
        public Key GetKey()
        {
            return new Key(Seqno);
        }


        #endregion
    }
}
